#include <stdio.h>
int main()
{
    FILE *fp = NULL;    char buff[255];

    fp = fopen("test.txt", "r");
    /* fgetc() and putchar() */
    char aChar;
    do
    {
        aChar =  fgetc(fp);        putchar(aChar);
    }
    while (aChar != '\n');

    /* fgets() and puts() */
    fgets(buff, 29, (FILE*)fp);    puts(buff);

    /*fscanf() and printf()*/
    for (int i=0; i<6; i++)
    {
        fscanf(fp, "%s", buff);        printf("%s ", buff );
    }
	printf("\n");
    for (int i=0; i<6; i++)
    {
        fscanf(fp, "%s", buff);        printf("%s ", buff );
    }
    
    fclose(fp);//close file
}

